<template>
	<div class="replace-page">
		<div>
			<textarea style="width:100%; height:300px; font-size:14px;" v-model="text"></textarea>
		</div>
		<div>
			<div class="mt10">
				<span>A</span>
				<input style="width:90%" type="text" v-model="from"> 
			</div>
			<div class="mt10">
				<span>B</span>
				<input style="width:90%" type="text" v-model="to"> 
			</div>
		</div>
		<div>
			<cc-button @click="convertA2B">A-B</cc-button>
			<cc-button @click="test2local">test-local</cc-button>
			<cc-button @click="local2Test">local-test</cc-button>
			<cc-button @click="test2domain">test-domain</cc-button>
		</div>
    </div>
</template>
<script type="text/javascript">

	module.exports = {
		data: function() {
			return {
				text: '',
				from: 'http://test.urtrust.com.cn/upay/',
				to: 'http://127.0.0.1:7001/newpay/'
			}
		},
		methods: {
			convertA2B: function() {
				console.log("convert A 2 B");
				this.text = this.text.replace(this.from, this.to);
			},
			test2local: function() {
				console.log("test2local");
				this.text = this.text.replace(this.from, this.to);
			},
			local2Test: function() {
				this.text = this.text.replace("http://10.13.1.92:9111/upay/", this.from);
				this.text = this.text.replace("http://127.0.0.1:7001/newpay/", this.from);
				this.text = this.text.replace("localhost", "10.13.1.92");
			},
			test2domain: function() {
				this.text = this.text.replace("http://10.13.1.92:9112/", "http://test.urtrust.com.cn/");
			}
		}
	}
</script>

<style type="text/css">
	.replace-page {}
</style>